Multiple search tree (b-tree) index, speeds up the retrieval of data, Elasticsearch andLucene uses a structure called the Reverse Index (inverted index) to achieve the same functionality. Example
Imagine that we are creating a new employee list system for a company called Megacorp, which should be able to work together in real time, so it should meet the following requirements: Data can contain multiple values of labels, numbers, and plain text conte
of the above information can be viewed in http://localhost:9200/_plugin/head/after installing the head plugin2. Install the head pluginCD to Elasticsearch-1.6.0/bin directory, run./plugin-install Mobz/elasticsearch-head,After installing and starting Elasticsearch, you can see the information of ES clusters, nodes, indexes, data, and so on when the browser opens http://localhost:9200/_plugin/head/.Second, the basic operationMain operation: increase, delete, change, check, batch operation,1. Buil
), type (Types), document (Documents), field (fields)Create dataPut/megacorp/employee/1{"First_Name": "John","Last_Name": "Smith","Age": 25,"About": "I love to go rock climbing","Interests": ["Sports", "music"]}Put/megacorp/employee/3{"First_Name": "Douglas","Last_Name": "Fir","Age": 35,"About": "I like to build cabinets","Interests": ["forestry"]}Note that the path/MEG
1. What is ElasticsearchElasticsearch is an open source real-time distributed search and analysis engine based on Apche Lucene.2. InstallationThe only requirement to install Elasticsearch is to install the official version of Java, address: www.java.comDownload the latest version of Elasticsearch in Elasticsearch.org/download.3. Running./bin/elastichsearch-d (-d parameter run for daemon mode)Curl ' Http://localhost:9200/?pretty ' can see the status200 information, stating that Elasticsearch is u
Use Environment
elasticsearch5.1.1
kibana5.1.1
Synonyms plugin 5.1.1
Installing plugins
download the corresponding elasticsearch-analysis-dynamic-synonym-5.1.1.zip, unzip to the local elasticsearch/plugins directory, restart ES
first way local file
Description:
for local files: mainly through the file modification timestamp (Modify time) to determine whether to reload
in the Elasticsearch/config directory, set up the analysis directory, and put Synonym.txt in the profile, add the follow
Simple searchGETThe request is very simple-you can easily get the document you want. Let's try something further, like a simple search!We try one of the simplest search requests for all employees:GET /megacorp/employee/_searchNext, let's search for employees whose last name contains "Jake" . To do this, we'll use a lightweight search method on the command line. This method is often referred to as a query string Search because we pass a query statement
1. Find the most common hobbies for all employees:Get/megacorp/employee/_search {"Aggs": {"all_interests": {"Terms": {"field": "Interes ts "}}}}We can see two employees who are interested in music, one like Lin, the other is sports.2. Find the largest interests of employees whose surname is Smith:get/megacorp/employee/_search{ "Query":{ "Match":{ "last_name": "Smith" }}, "Aggs":{ "All_interests":{ #all_
Only need JDK, download unzip can, best modified under ELASTICSEARCH.YMLCluster.namenode.nameES has a very rich plugin, it is recommended to install the following severalBigdeskresource monitoring and cluster management plug-in bin/plugin-install lukas-vlcek/bigdeskhttp://127.0.0.1:9200/_plugin/ BigdeskElasticsearch-headdata Query Plugin bin/plugin-install mobz/elasticsearch-headhttp://localhost:9200/_plugin/ head/Elasticsearch-inquisitorplugin for debugging query statements bin/plugin-install p
CTRL + C can close node, if not, then useHttp://localhost:9200/_shutdown, shut it down.Relationship with the relational database if compared to the RDB, then relational Db⇒databases⇒tables⇒rows⇒columnselasticsearch⇒indices⇒types⇒documents⇒fi ELDs Data Read/write insert/Update dataYou see? EMPLOYEE/1 to take 1, usually with keyFetching dataGet/megacorp/employee/1*put insert data, get get data, delete deletes data, head queries for data, update data? J
(instead of facet) aggregation, etc. , the official website (https://www.elastic.co/guide/index.html) has a rich sample of queries. Similarly, it supports bulk API bulk queries, reducing network round trips. Full-Text SearchA feature that is difficult to implement in a traditional database. We will search all employees who like rock climbing:get/megacorp/employee/_search{"Query": {"match": {"about": "Rock Climbing"}}You will find that we also used th
contains a lot of fields (columns).Elasticsearch's interactions can be either using Java APIs or using HTTP's RESTful API, for example, we're going to insert a record that can simply send an HTTP request:PUT /megacorp/employee/1{ "name" : "John", "sex" : "Male", "age" : 25, "about" : "I love to go rock climbing", "interests": [ "sports", "music" ]}Update, the query is similar to the operation, the specific operating ma
installation and use user name: elastic password: @Dc? $qz 3w6ezf%juwkd+ Login
Note: The role of elastic is Superuser superuser, Superuser can use API actions in Dev Tools Es,kibana the role of the user is Kibana_system, through management can manage users, such as creating users, Modify the password (for convenience, the password is changed to 123456), assign permissions, etc.Dev Tools: Curl can be simplified operation es, only to specify the HTTP verb, API path and parameters. For example
Pu
Elasticsea Rch. A mapping is also used to configure metadata associated with the type.
Mapping defines the data types of many fields in the type and how those fields are elasticsearch processed, such as whether a field can be queried and how to participle. Custom Mapping
The following is a simple mapping definition:
curl-xput ' Http://localhost:9200/megacorp '-d ' {"Settings": {"Number_of_shards":
3, "Number_of_replicas": 1}, "mapping
Contact Us
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.